<?php
//必须参数keyid,site
require_once dirname(__FILE__).'/include/common.inc.php';

$keyid=$_GET["keyid"];
$site=$_GET["site"];


$sql="select count(*) as countx from caiji_keyword";
$re=$db->query($sql);
$re=$db->fetch_array($re);
$countx=$re[countx];
if($keyid<1 || $keyid>$countx)
{
	return;
}



$sql="select title from caiji_keyword limit ".$keyid;
$re=$db->query($sql);
$keyinfo;
while($r=$db->fetch_array($re))
{
	$keyinfo=$r;
}

//echo $keyinfo[tag];

$url="http://news.google.com/news/search?ned=tcn&hl=zh-CN&as_maxm=5&q=site%3Asina.com.cn+%E8%B6%B3%E7%90%83&as_drrb=b&as_mind=9&as_minm=5&cf=all&as_maxd=10&scoring=n&start=0";

$para="site:".$site." ".$keyinfo[title];
$para=urlencode($para);


$timem=date("m");
$timed2=date("d");
$timed1=date("d",strtotime("-1 day"));

$url="http://news.google.com/news/search?ned=tcn&hl=zh-CN&q=".$para."&as_drrb=b&as_minm=".$timem."&as_mind=".$timed1."&as_maxm=".$timem."&as_maxd=".$timed2."&scoring=n&cf=all&start=0";

//echo $url;
header("location:".$url); 

?>